package com.zhaojun.cloud.service.order.controller;

import com.zhaojun.cloud.common.mapper.service.ISeckillAccessService;
import com.zhaojun.cloud.common.pojo.Seckill;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * wwj
 * 2019/1/2  17:16
 */
@RestController
@RequestMapping("/seckillList")
public class SeckillListController {

    private final Logger logger = LoggerFactory.getLogger(SeckillListController.class);

    @Autowired
    private ISeckillAccessService iSeckillAccessService;

    @RequestMapping("/list")
    public Object list() {
        Map<String, Object> result = new HashMap<>();
        List<Seckill> seckill = iSeckillAccessService.list();
        //layui code 默认成功状态码是0
        result.put("code", 0);
        result.put("msg", "查询成功");
        result.put("count", seckill.size());
        result.put("data", seckill);
        return result;
    }
}
